package operation.iterator.obj.iterators;

import java.util.Iterator;

import operation.iterator.obj.Department;

public class ComputerCollegeIterator implements Iterator<Department> {
    Department[] departments;
    int index = 0;

    public ComputerCollegeIterator(Department[] departments) {
        this.departments = departments;
    }

    @Override
    public boolean hasNext() {
        return index < departments.length && departments[index] != null;
    }

    @Override
    public Department next() {
        return departments[index++];
    }

    @Override
    public void remove() {
    }
}